
import 'dart:ui' as ui;

import 'package:flutter/services.dart';
class ImageUtil {
  static Future<ui.Image> getUIImage(String imageUrl,{int? width,int? height}) async {

    final ByteData assetImageByteData = await rootBundle.load(imageUrl);
    final codec = await ui.instantiateImageCodec(
      assetImageByteData.buffer.asUint8List(),
      targetHeight: width,
      targetWidth: height,
    );
    final image = (await codec.getNextFrame()).image;

    return image;
  }
}